//
//  ViewControllerA.m
//  NavigationBarTest
//
//  Created by Clavis on 2019/2/14.
//  Copyright © 2019 Clavis. All rights reserved.
//

#import "ViewControllerA.h"
#import "UIImage+Add.h"
#import "UIViewController+Cloudox.h"

@interface ViewControllerA ()

@property (weak, nonatomic) IBOutlet UISlider *slider;

@end

@implementation ViewControllerA

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    
    self.slider.maximumValue = 1;
    self.slider.minimumValue = 0;
    
   self.view.backgroundColor = UIColor.lightGrayColor;
}


- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    
    self.title = @"VC A";
    self.nameLabel.text = @"VC A";
    self.navigationController.navigationBar.barTintColor = UIColor.whiteColor;
    
//    UIImage *image = [[UIImage imageNamed:@"image"] imageByApplyingAlpha:self.slider.value];
//    [self.navigationController.navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];
    
//    //设置导航栏背景图片为一个空的image，这样就透明了
//    [self.navigationController.navigationBar setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault];
//
//    //去掉透明后导航栏下边的黑边
//    [self.navigationController.navigationBar setShadowImage:[[UIImage alloc] init]];
//
//    //设置导航栏透明
//    [self.navigationController.navigationBar setTranslucent:true];
//    //把背景设为空
//    [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
//    //处理导航栏有条线的问题
//    [self.navigationController.navigationBar setShadowImage:[UIImage new]];
    
    
    
    [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
    //去掉导航栏底部的黑线
    self.navigationController.navigationBar.shadowImage = [UIImage new];
    
}

- (IBAction)sliderValueChange:(id)sender {
    
//    UIImage *image = [[UIImage imageNamed:@"image"] imageByApplyingAlpha:self.slider.value];
//
//    [self.navigationController.navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];
    

    
//    self.navBarBgAlpha = [NSString stringWithFormat:@"%.1f",self.slider.value];
    
}


@end
